package com.nbsaas.boot.site.rest.resource;

import com.nbsaas.boot.site.api.apis.AdviseApi;
import com.nbsaas.boot.site.data.entity.Advise;
import com.nbsaas.boot.site.api.domain.request.AdviseRequest;
import com.nbsaas.boot.site.api.domain.response.AdviseResponse;
import com.nbsaas.boot.site.api.domain.simple.AdviseSimple;
import com.nbsaas.boot.site.rest.convert.AdviseSimpleConvert;
import com.nbsaas.boot.site.rest.convert.AdviseEntityConvert;
import com.nbsaas.boot.site.rest.convert.AdviseResponseConvert;
import com.nbsaas.boot.site.data.repository.AdviseRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class AdviseResource extends BaseResource<Advise,AdviseResponse, AdviseSimple, AdviseRequest>  implements AdviseApi {

    @Resource
    private AdviseRepository adviseRepository;

    @Override
    public JpaRepositoryImplementation<Advise, Serializable> getJpaRepository() {
        return adviseRepository;
    }

    @Override
    public Function<Advise, AdviseSimple> getConvertSimple() {
        return new AdviseSimpleConvert();
    }

    @Override
    public Function<AdviseRequest, Advise> getConvertForm() {
        return new AdviseEntityConvert();
    }

    @Override
    public Function<Advise, AdviseResponse> getConvertResponse() {
        return new AdviseResponseConvert();
    }




}


